package com.journey.org.ui.knowledge.play.list

import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.journey.org.BR
import com.journey.org.R
import com.journey.org.databinding.FragmentPlayAndroidListBinding
import com.mvvmhabit.org.base.BaseLazyFragment

/**
 * @Date: 2020/12/18 10:30
 * @Author:小妖
 * @Description: 项目列表
 */
class PlayAndroidListFragment :
    BaseLazyFragment<FragmentPlayAndroidListBinding, PlayAndroidListViewModel>() {

    private var cid: Int = 0

    override fun initParam() {
        super.initParam()
        cid = arguments!!.getInt("id")
    }

    override fun initVariableId(): Int = BR.viewModel

    override fun initViewModel(): Class<PlayAndroidListViewModel> =
        PlayAndroidListViewModel::class.java

    override fun initContentView(
        inflater: LayoutInflater?,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): Int = R.layout.fragment_play_android_list

    override fun lazyLoadData() {
        if (cid != 0) {
            mViewModel?.onIdField?.set(cid.toString())
            mViewModel?.loadPlayAndroidList(cid.toString())
        }
    }
}